package com.qk.mangement.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.qk.domain.business.BusinessCountDO;
import com.qk.domain.clue.ClueCountDO;
import com.qk.mangement.annoation.RedisAnnotation;
import com.qk.mangement.mapper.BusinessMapper;
import com.qk.mangement.mapper.ClueMapper;
import com.qk.mangement.service.ReportOverviewService;
import com.qk.vo.portal.PortalVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

/**
 * Date:2025/10/15
 * Author:zxc
 * Description
 */
@Slf4j
@Service
@SuppressWarnings("all")
public class ReportOverviewServiceImpl implements ReportOverviewService {

    @Autowired
    private  ClueMapper clueMapper;
    @Autowired
    private BusinessMapper businessMapper;
    @Autowired
    private StringRedisTemplate redisClient;




    @RedisAnnotation
    @Override
    public PortalVO reportOverviewWitchCache() {
        log.info("查询MySQL");
        ClueCountDO clueCountDO = clueMapper.selectCountClue();
        BusinessCountDO businessCountDO = businessMapper.selectCountBusiness();
        PortalVO vo = BeanUtil.copyProperties(clueCountDO, PortalVO.class);
        BeanUtil.copyProperties(businessCountDO,vo);
        return vo;
    }

    @Override
    public PortalVO reportOverview() {
        ClueCountDO clueCountDO=clueMapper.selectCountClue();
        BusinessCountDO businessCountDO=businessMapper.selectCountBusiness();
        PortalVO vo = BeanUtil.copyProperties(clueCountDO, PortalVO.class);
        BeanUtil.copyProperties(businessCountDO,vo);
        return vo;

    }
}

